package cn.edu.cug.cs.gtl.renders.openinventor.basics;

import cn.edu.cug.cs.gtl.apis.render.basics.Box2f;
import com.openinventor.inventor.SbBox2f;

public class Box2fImpl implements Box2f {
    private SbBox2f nativeObject = null;
    public Box2fImpl(){
        this.nativeObject = new SbBox2f();
    }

    public Box2fImpl(SbBox2f v){
        this.nativeObject = v;
    }
    @Override
    public Object getNativeObject() {
        return nativeObject;
    }

    @Override
    public boolean attach(Object nativeObject) {
        if(nativeObject instanceof  SbBox2f){
            this.nativeObject = (SbBox2f) nativeObject;
            return true;
        }
        return false;
    }

    @Override
    public Object detach() {
        Object r = this.nativeObject;
        this.nativeObject=null;
        return r;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof Box2f)
            return nativeObject.equals(((Box2fImpl)obj).nativeObject);
        else if(obj instanceof SbBox2f){
            return nativeObject.equals(obj);
        }
        else
            return false;
    }
}
